﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Aj.Core.Cache
{

    public interface ICache
    {
        /// <summary>
        /// 添加指定ID的对象
        /// </summary>
        /// <param name="key">缓存键</param>
        /// <param name="item">缓存对象</param>
        void AddObject(string key, object item);
        /// <summary>
        /// 添加指定ID的对象(关联时间)
        /// </summary>
        /// <param name="key">缓存键</param>
        /// <param name="item">缓存对象</param>
        /// <param name="expire">到期时间,单位:时间</param>
        void AddObject(string key, object item, DateTime expire);
        /// <summary>
        /// 添加指定ID的对象(关联时间)
        /// </summary>
        /// <param name="key">缓存键</param>
        /// <param name="item">缓存对象</param>
        /// <param name="expire">到期时间,单位:秒</param>
        void AddObject(string key, object item, int expire);
        /// <summary>
        /// 添加指定ID的对象(关联指定文件组)
        /// </summary>
        /// <param name="key">缓存键</param>
        /// <param name="item">缓存对象</param>
        /// <param name="files">关联的文件名</param>
        void AddObject(string key, object item, string[] files);
        /// <summary>
        /// 添加指定ID的对象(关联指定文件组)
        /// </summary>
        /// <param name="key">缓存键</param>
        /// <param name="item">缓存对象</param>
        /// <param name="files">关联的文件名</param>
        /// <param name="expire">到期时间,单位:秒</param>
        void AddObject(string key, object item, string[] files, int expire);
        /// <summary>
        /// 添加指定ID的对象(关联指定文件组)
        /// </summary>
        /// <param name="key">缓存键</param>
        /// <param name="item">缓存对象</param>
        /// <param name="files">关联的文件名</param>
        /// <param name="dependKey">依赖键</param>
        void AddObject(string key, object item, string[] files, string[] dependKey);
        /// <summary>
        /// 添加指定ID的对象(关联指定文件组)
        /// </summary>
        /// <param name="key">缓存键</param>
        /// <param name="item">缓存对象</param>
        /// <param name="files">关联的文件名</param>
        /// <param name="dependKey">依赖键</param>
        /// <param name="expire">到期时间,单位:秒</param>
        void AddObject(string key, object item, string[] files, string[] dependKey, int expire);
        /// <summary>
        /// 添加指定ID的对象(关联指定键值组)
        /// </summary>
        /// <param name="key">缓存键</param>
        /// <param name="item">缓存对象</param>
        /// <param name="dependKey">依赖键</param>
        void AddObjectWithDepend(string key, object item, string[] dependKey);
        /// <summary>
        /// 添加指定ID的对象(关联指定键值组)
        /// </summary>
        /// <param name="key">缓存键</param>
        /// <param name="item">缓存对象</param>
        /// <param name="dependKey">依赖键</param>
        /// <param name="expire">到期时间,单位:秒</param>
        void AddObjectWithDepend(string key, object item, string[] dependKey, int expire);
        /// <summary>
        /// 移除指定ID的对象
        /// </summary>
        /// <param name="key">缓存键</param>
        void RemoveObject(string key);
        /// <summary>
        /// 返回指定ID的对象
        /// </summary>
        /// <param name="key">缓存键</param>
        /// <returns></returns>
        object GetObject(string key);
        /// <summary>
        /// 清空的有缓存数据
        /// </summary>
        void FlushAll();
        /// <summary>
        ///  判断给定的键是否已经拥有缓存项
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        bool Contains(string key);
    }
}
